<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html> 
<html>
<head>
    <title><spring:message code="message.list.AnShangPinChaKan"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>按药品查询</h1>
        <ol class="breadcrumb">
           	<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
			<li class="active"><a href="#">交易</a></li>
			<li class="active"><a href="#">药品遴选情况</a></li>
            <li class="active"><a href="#">按药品查询</a></li>
        </ol>
    </section>
    
    <section class="content">
       <form id="form" method="post" class="form-horizontal">
        <div class=" box box-success">
            <div class="box-body">
            	<div class="input">
					<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugName" name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugCode" name="drugCode"  placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
                    </div>
					<div class="textalign"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                         <input type="text" class="textinput" id="prodComp" name="prodComp"  placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" />
                    </div>
				</div>
                <div class="input" style="margin-top:3px">
                    <div class="textalign1"><spring:message code="message.listForm.XiangMuMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="projName" name="projName" placeholder="<spring:message code="message.listForm.XiangMuMingCheng"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.listForm.BeiAnLeiXing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <select class="textinput" id="isLongTimePlan" name="isLongTimePlan">
                            <option value=""><spring:message code="message.select.option"/></option>
							<option value="0"><spring:message code="message.listForm.LinShiBeiAn"/></option>
                            <option value="1"><spring:message code="message.listForm.ChangQiBeiAnLeiXing"/></option>
                        </select>
                    </div>
                    <div class="textalign" >
                    <button type="button"  onclick="gridSerch()"  class="btn btn-success btn-sm"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                    </div>
                </div>
                </div>
            </div>
        </form>
        <table class="jqgrid" id="gridlist"></table>
        <div id="prowed2"></div>
</section>

<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">
//绑定回车
$('#drugName,#drugCode,#prodComp,#bakDrugFlag,#isLongTimePlan,#projName').bind('keydown', function(event) {
    if (event.keyCode == "13") {
        $('#selectDicCompType').click();
    }
});	
$("#drugName").focus();//加载页面光标在第一个查询框内




		$(function () {
			jQuery("#gridlist").jqGrid({
			    url: "getGoodsList.html",
			    mtype: "POST",
			    datatype: "json",
			    autowidth: true,
			    shrinkToFit:false,
			   // height: 327,
			    colNames:[
			              '<spring:message code="message.jqGrid.cz"/>',
						  '<spring:message code="message.listForm.CaiGouJia"/>',
			              '<spring:message code="message.listForm.ZuiGaoLingShouJia"/>',
			              '<spring:message code="message.listForm.yaoPinBianMa"/>',
		                  '<spring:message code="message.listForm.tongYongMing"/>', 
		                  '<spring:message code="message.listForm.jiXing"/>',
		                  '<spring:message code="message.listForm.guiGe"/>',
		                  '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
		                  '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
		                  '<spring:message code="message.listForm.caiZhi"/>',
			              'prodCompId',
			              '<spring:message code="message.listForm.shengChanQiYe"/>',			             
			              '国药准字',
			              '<spring:message code="message.listForm.shangBianMa"/>',
			              '<spring:message code="message.listForm.XiangMuMingCheng"/>',
			              '<spring:message code="message.listForm.YaoPinFenLei"/>',
			              '<spring:message code="message.listForm.IsorNoBeiAn"/>',
			              '<spring:message code="message.listForm.BeiAnLeiXing"/>'
			             
			              ],
			    colModel:[
	            	{ name: 'opr', width: 50 , align:"center",sortable: false,
			            formatter: function (val, opts, rowdata) {
			              var getDate ="?goodsCode="+rowdata.goodsCode+"&drugCode="+rowdata.drugCode+"&drugName="+rowdata.drugName+"&formName="+rowdata.formName+"&specName="+rowdata.specName+"&factor="+rowdata.factor+"&unit="+rowdata.unit+"&materialName="+rowdata.materialName+"";
			              return "<a  href='toCatalogByGoods.html"+encodeURI(getDate)+"&userType=${userType}' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='<spring:message code='message.jqGrid.cz.xiangQing' />'></a>";
			            }       
			        },
					{name:'proPriceLimit',index:'proPriceLimit', width:100 , align:"right",sortable: false},
                    {name:'retailPriceLimit',index:'retailPriceLimit', width:100 , align:"right",sortable: false},
			        {name:'drugCode',index:'drugCode',sortable: false, width:100, align:"center",sorttype:false},
			        {name:'drugName',index:'drugName',sortable: false, width:180, sorttype:false , align:"center"},
			        {name:'formName',index:'formName',sortable: false, width:100, align:"center"},
			        {name:'specName',index:'specName',sortable: false, width:100 , align:"center",sorttype:false},
			        {name:'factor',index:'factor',sortable: false, width:80, align:"center",sorttype:false},
			        {name:'unit',index:'unit', width:80, align:"center",sortable: false,sorttype:false},
			        {name:'materialName',index:'materialName',sortable: false, width:80, align:"center",sorttype:false},
			        
			        
			        
			       
			        {name: 'prodCompcode',hidden:true, width: 20 , align:"center" ,sortable: false},
			        
			       
			        {name:'prodCompname',index:'prodComp',sortable: false, width:180 , align:"center",sorttype:false},
			        {name:'drugMedicine',index:'drug_medicine',sortable: false, width:180 , align:"center",sorttype:false},
			        {name:'goodsCode',hidden:true,index:'goods_code',sortable: false,  align:"center", width:120, sorttype:"date"},
			        
			        {name:'projName',index:'projName',sortable: false, width:180 , align:"center",sorttype:false},
			        {name:'goodsSource',index:'goodsSource', width:100 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return cellvalue == 1 ? "基本药物" : "非基本药物";
                        }
                    },
			        {name:'drugCat',index:'drugCat', width:100,sortable: false , align:"center",sorttype:false,
			        	 formatter:function(cellvalue, options, row){
	                            return cellvalue == 5 ? "<spring:message code="message.listForm.shi"/>" : "<spring:message code="message.listForm.fou"/>";
	                        }
			        },
                    {name:'isLongTimePlan',index:'isLongTimePlan', width:100 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            var str = "";
                            if (row.goodsSource == 5) {
                                str += cellvalue == 1 ? "<spring:message code="message.listForm.ChangQiBeiAnLeiXing"/>" : "<spring:message code="message.listForm.LinShiBeiAn"/>";
                            }
                            return str;
                        }
                    }
			    ],
			     rowNum: 20,
			     rowList: [10, 20, 50, 100],
			     rownumbers: true,
			     multiselect: true,
			     pager: "#prowed2",
			     viewrecords: true,
			     gridComplete:function(){
	                	//序号列宽度自适应（参数为jqgridID）
	                    autoRNWidth("gridlist");
	                	//数据只有一条时默认选中（参数为jqgridID）
	                    selectByOneData("gridlist");
	                },
			     caption: "<spring:message code="message.list.proddruginfoStdlist"/>",
			     editurl:"proPlanItemListHis.jsp",
			     jsonReader: {
			         repeatitems: false,
			         id: "ids"
			     }
			});
			     
			    jQuery("#gridlist").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
				$(window).trigger("resize");
				$("#gridlist").jqGrid("setGridHeight",create());
			    
		});
		function gridSerch() {
		    var goodsCode = $.trim($("#goodsCode").val());
		    var drugCode = $.trim($("#drugCode").val());
		    var drugName = $.trim($("#drugName").val());
		    var formName = $.trim($("#formName").val());
		    var specName = $.trim($("#specName").val());
		    var prodComp = $.trim($("#prodComp").val());
		    var projName = $.trim($("#projName").val());
		    var isLongTimePlan = $("#isLongTimePlan").val();
		    $("#gridlist").jqGrid('setGridParam',{  
		        datatype:'json',
		        postData:{
		        	"goodsCode":goodsCode,
	                "drugCode":drugCode,
	                "drugName":drugName,
	                "formName":formName,
	                "specName":specName,
	                "prodComp":prodComp,
	                "projName":projName,
	                "isLongTimePlan":isLongTimePlan
		        },
		        page:1
		    }).trigger("reloadGrid"); //重新载入  
		}
		
</script>
</body>
</html>